When doing local migration, a timing-related problem occurred due to the
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 17 May 2006 22:28:22 +0000 (23:28 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 17 May 2006 22:28:22 +0000 (23:28 +0100)
frontend switching to the Closed state, which could end up having
the .remove function being called after the backend has shut down. This
now fixes the problem by switching to the Closing state.
The other part of the patch cleans up freeing of memory.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
linux-2.6-xen-sparse/drivers/xen/tpmback/common.h
linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c
linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c

index bf58e109dd878fd9899a7be22f90979e517b4c39..9c0618f68c708f6be8a17cc75901f218ac87ff9f 100644 (file)
@@ -416,7 +416,7 @@ static int tpmfront_suspend(struct xenbus_device *dev)
                 */
                interruptible_sleep_on_timeout(&tp->wait_q, 100);
        }
-       xenbus_switch_state(dev, XenbusStateClosed);
+       xenbus_switch_state(dev, XenbusStateClosing);
 
        if (atomic_read(&tp->tx_busy)) {
                /*
index 0fafd570967600587beec75f5f496f1a76ad183a..744248d638eef2b5acb23318f071444bdd4ee7bf 100644 (file)
@@ -45,8 +45,6 @@ typedef struct tpmif_st {
        long int tpm_instance;
        unsigned long mmap_vstart;
 
-       struct work_struct work;
-
        grant_handle_t shmem_handle;
        grant_ref_t shmem_ref;
        struct page *pagerange;
index 0992ad962d5286c34ecbf5d4e39dc7beb384c94d..39117458d51aaa33da741627584b1f8faf31223b 100644 (file)
@@ -152,10 +152,8 @@ int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn)
        return 0;
 }
 
-static void __tpmif_disconnect_complete(void *arg)
+void tpmif_disconnect_complete(tpmif_t *tpmif)
 {
-       tpmif_t *tpmif = (tpmif_t *) arg;
-
        if (tpmif->irq)
                unbind_from_irqhandler(tpmif->irq, tpmif);
 
@@ -167,12 +165,6 @@ static void __tpmif_disconnect_complete(void *arg)
        free_tpmif(tpmif);
 }
 
-void tpmif_disconnect_complete(tpmif_t * tpmif)
-{
-       INIT_WORK(&tpmif->work, __tpmif_disconnect_complete, (void *)tpmif);
-       schedule_work(&tpmif->work);
-}
-
 void __init tpmif_interface_init(void)
 {
        tpmif_cachep = kmem_cache_create("tpmif_cache", sizeof (tpmif_t),
index 302d9e9f9ffd9b7eb49413a31fccaa2299cc9169..0aa980e58f62043f0d4d8a772862da1b1dad2711 100644 (file)
@@ -1063,7 +1063,7 @@ static int __init tpmback_init(void)
 
 module_init(tpmback_init);
 
-static void __exit tpmback_exit(void)
+void __exit tpmback_exit(void)
 {
        vtpm_release_packets(NULL, 0);
        tpmif_xenbus_exit();
index 61b9250e8dba36609593b0c29a2a210e607acb4d..fc5313071c9198a98d9e9d8afb5b864ed93e174b 100644 (file)
@@ -150,7 +150,7 @@ static void frontend_changed(struct xenbus_device *dev,
                break;
 
        case XenbusStateClosing:
-               xenbus_switch_state(dev, XenbusStateClosing);
+               be->tpmif->tpm_instance = -1;
                break;
 
        case XenbusStateClosed: